let a = [-1,0,1,2,-1,-4];
// a.sort((m,n) => m-n);

function n3(array) {
    let ca = 0
    for (let i = 0; i < array.length; i++) {
        for (let j = i + 1; j < array.length; j++) {
            for (let k = j+1; k < array.length; k++) {
                console.log([array[i], array[j], array[k]]);
                ca++;
            }
        }
    }
    console.log(ca);
}

n3(a)
console.log("=====")
// n3(b)